package com.cssy.xxkj.logic.dao.impl;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicAllocatOutwhDAO;
import com.cssy.xxkj.logic.entity.LogicAllocatOutwhDO;
import com.plat.helper.SearchConditions;

/**
 * gzy
 * @since 2014-09-26
 */
public class LogicAllocatOutwhDAOImpl extends SqlMapClientDaoSupport implements LogicAllocatOutwhDAO {

    public String insertLogicAllocatOutwhDO(LogicAllocatOutwhDO logicAllocatOutwhDO) {
        Object id = getSqlMapClientTemplate().insert("LogicAllocatOutwh.insert", logicAllocatOutwhDO);
        return (String) id;
    }

    public Integer countLogicAllocatOutwhDOByExample(LogicAllocatOutwhDO logicAllocatOutwhDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicAllocatOutwh.countByDOExample", logicAllocatOutwhDO);
        return count;
    }

    public Integer updateLogicAllocatOutwhDO(LogicAllocatOutwhDO logicAllocatOutwhDO) {
        int result = getSqlMapClientTemplate().update("LogicAllocatOutwh.update", logicAllocatOutwhDO);
        return result;
    }

    @SuppressWarnings("unchecked")
    public List<LogicAllocatOutwhDO> findListByExample(LogicAllocatOutwhDO logicAllocatOutwhDO) {
        List<LogicAllocatOutwhDO> list = getSqlMapClientTemplate().queryForList("LogicAllocatOutwh.findListByDO", logicAllocatOutwhDO);
        return list;
    }

    public LogicAllocatOutwhDO findLogicAllocatOutwhDOByPrimaryKey(String id) {
        LogicAllocatOutwhDO logicAllocatOutwhDO = (LogicAllocatOutwhDO) getSqlMapClientTemplate().queryForObject("LogicAllocatOutwh.findByPrimaryKey", id);
        return logicAllocatOutwhDO;
    }

    public Integer deleteLogicAllocatOutwhDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicAllocatOutwh.deleteByPrimaryKey", id);
        return rows;
    }

	@SuppressWarnings("unchecked")
	public List<LogicAllocatOutwhDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicAllocatOutwhDO> list = getSqlMapClientTemplate().queryForList("LogicAllocatOutwh_ex.find", scs);
        return list;
	}

	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicAllocatOutwh_ex.count", scs);
        return count;
	}

	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().update("LogicAllocatOutwh_ex.deleteBizRemoved", id);
        return count;
	}

}